Skip to content

Conversation

@srittau
Copy link
Collaborator

@srittau srittau commented Jan 4, 2024

Part of #10113

@srittau
Copy link
Collaborator Author

srittau commented Jan 4, 2024

This PR contains only infrastructure work. Changes to the stubs themselves will follow in a subsequent PR.

@AlexWaygood
Copy link
Member

AlexWaygood commented Jan 4, 2024

You can also delete the lint in check_new_syntax.py that checks we're not using any PEP-570 syntax (but it's also fine to leave that to a followup PR):

class PEP570Finder(ast.NodeVisitor):
def __init__(self) -> None:
self.lineno: int | None = None
def _visit_function(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None:
old_lineno = self.lineno
self.lineno = node.lineno
self.generic_visit(node)
self.lineno = old_lineno
visit_FunctionDef = visit_AsyncFunctionDef = _visit_function
def visit_arguments(self, node: ast.arguments) -> None:
if node.posonlyargs:
assert isinstance(self.lineno, int)
errors.append(
f"{path}:{self.lineno}: PEP-570 syntax cannot be used in typeshed yet. "
f"Prefix parameter names with `__` to indicate positional-only parameters"
)
self.generic_visit(node)

@AlexWaygood
Copy link
Member

And this can also be deleted:

typeshed/CONTRIBUTING.md

Lines 282 to 286 in 54447f6

Accepted features that *cannot* yet be used in typeshed include:
- [PEP 570](https://www.python.org/dev/peps/pep-0570/) (positional-only
arguments): see [#4972](https://github.com/python/typeshed/issues/4972),
use argument names prefixed with `__` instead

@srittau
Copy link
Collaborator Author

srittau commented Jan 4, 2024

And this can also be deleted:

typeshed/CONTRIBUTING.md

Lines 282 to 286 in 54447f6

Accepted features that *cannot* yet be used in typeshed include:
- [PEP 570](https://www.python.org/dev/peps/pep-0570/) (positional-only
arguments): see [#4972](https://github.com/python/typeshed/issues/4972),
use argument names prefixed with `__` instead

I removed it, but didn't add it to supported features, as it's not really a typing feature.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@srittau srittau merged commit 4e5f7a7 into python:main Jan 4, 2024
@srittau srittau deleted the rm-3.7 branch January 4, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants